home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Shareware / Programare / sharp / wwwSharp_setup.exe / {app} / Examples / Data access / Update / index.hta next >
Text File  |  2003-12-28  |  3KB  |  115 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4.     <TITLE>wwwSharp.ClrHost update example</TITLE>
  5.     <META name="GENERATOR" content="MSHTML 6.00.2800.1276">
  6.     <META http-equiv="MSThemeCompatible" content="Yes">
  7.     <LINK href="Update.css" type="text/css" rel="stylesheet">
  8.     <OBJECT id="AppDomain" classid="clsid:89F1D07D-3AC6-4ACB-B8A4-8EDDDCB0142E"></OBJECT>
  9.     <OBJECT id="dsDataSet" classid="clsid:A53ECD51-C062-4B08-97F0-4944CD7D88E7">
  10.         <PARAM name="AssemblyName"
  11.             value="System.Data, Version=1.0.5000.0, PublicKeyToken=b77a5c561934e089, Culture=neutral">
  12.         <PARAM name="DataAdapterTypeName" value="System.Data.OleDb.OleDbDataAdapter">
  13.         <PARAM name="ConnectionTypeName" value="System.Data.OleDb.OleDbConnection">
  14.         <PARAM name="CommandBuilderTypeName" value="System.Data.OleDb.OleDbCommandBuilder">
  15.     </OBJECT>
  16.     <OBJECT id="viewCountry" classid="clsid:E3BC8FCA-E3F4-4B98-8627-9D3D343F9DA0">
  17.         <PARAM name="DataSetID" value="dsDataSet">
  18.         <PARAM name="TableName" value="country">
  19.     </OBJECT>
  20. <SCRIPT language="JScript">
  21. function Initialize()
  22. {
  23.     //ApplicationBase for main domain is directory where HTA is located.
  24.     dsDataSet.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
  25.         AppDomain.ApplicationBase + "test.mdb";
  26.     dsDataSet.FillTable("country", "Select * from country");
  27.     
  28.     viewCountry.Open();
  29. }
  30.  
  31. function OnBtnUpdate()
  32. {
  33.     //Send updates to DBMS
  34.     dsDataSet.Update("country");
  35. }
  36.  
  37. function viewCountryMoveFirst()
  38. {
  39.     viewCountry.recordset.MoveFirst()
  40. }
  41.  
  42. function viewCountryMovePrevious()
  43. {
  44.     viewCountry.recordset.MovePrevious();
  45.     if (viewCountry.recordset.BOF)
  46.         viewCountry.recordset.MoveFirst();
  47. }
  48.  
  49. function viewCountryMoveNext()
  50. {
  51.     viewCountry.recordset.MoveNext();
  52.     if (viewCountry.recordset.EOF)
  53.         viewCountry.recordset.MoveLast();
  54. }
  55.  
  56. function viewCountryMoveLast()
  57. {
  58.     viewCountry.recordset.MoveLast();
  59. }
  60. </SCRIPT>
  61. </HEAD>
  62. <BODY onload="Initialize()">
  63.  
  64.     <H2>Countries:</H2>
  65.  
  66.     <DIV id="divNavigation">
  67.         <BUTTON id="btnFirst" onclick="viewCountryMoveFirst()">< <</BUTTON>
  68.         <BUTTON id="btnPrev" onclick="viewCountryMovePrevious()"><</BUTTON>
  69.         <BUTTON id="btnNext" onclick="viewCountryMoveNext()">></BUTTON>
  70.         <BUTTON id="btnLast" onclick="viewCountryMoveLast()">> ></BUTTON> 
  71.     </DIV>
  72.     <DIV id="divTable">
  73.         <TABLE id="tblCustomers" width="100%">
  74.             <TBODY>
  75.                 <TR>
  76.                     <TD class="tdHeader">Name</TD>
  77.                     <TD>
  78.                         <INPUT dataFld="Name" dataSrc="#viewCountry">
  79.                     </TD>
  80.                 </TR>
  81.                 <TR>
  82.                     <TD class="tdHeader">Capital</TD>
  83.                     <TD>
  84.                         <INPUT dataFld="Capital" dataSrc="#viewCountry">
  85.                     </TD>
  86.                 </TR>
  87.                 <TR>
  88.                     <TD class="tdHeader">Continent</TD>
  89.                     <TD>
  90.                         <INPUT dataFld="Continent" dataSrc="#viewCountry">
  91.                     </TD>
  92.                 </TR>
  93.                 <TR>
  94.                     <TD class="tdHeader">Area</TD>
  95.                     <TD>
  96.                         <INPUT dataFld="Area" dataSrc="#viewCountry">
  97.                     </TD>
  98.                 </TR>
  99.                 <TR>
  100.                     <TD class="tdHeader">Population</TD>
  101.                     <TD>
  102.                         <INPUT dataFld="Population" dataSrc="#viewCountry">
  103.                     </TD>
  104.                 </TR>
  105.             </TBODY>
  106.         </TABLE>
  107.         <BUTTON id="btnUpdate" onclick="OnBtnUpdate();">Update</BUTTON>
  108.     </DIV>
  109.     <DIV id="divFooter">
  110.         <P id="creator">Created with <A href="http://www-sharp.com/" target="_blank"><STRONG>
  111.             www-Sharp</STRONG></A>.</P>
  112.     </DIV>
  113. </BODY>
  114. </HTML>
  115.